/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2024-10-08 17:16:15
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2025-02-24 12:44:57
 * @FilePath: \project\work-tool\experi-api\models\ListModel.js
 * @Description: 
 */
const moongoose = require('mongoose');
const Schema = moongoose.Schema;

// 字段类型

const type = {
  name: {
    type: String,
    required: true, // 设置必填项
    minLength: 0, // 可以设置最小长度
    maxLength: 50 // 设置最大长度
  },
  age: Number,
  email: {
    type: String,
    match: /^\S+@\S+\.\S+$/ // 正则表达式验证邮箱格式
  },
  password: {
    type: String,
    required: true,
    minLength: 6,
    maxLength: 20
  },
  createTime: {
    type: Date,
    default: Date.now
  },
  updateTime: {
    type: Date,
    default: Date.now
  }
}

const ListModel = moongoose.model("list", new Schema(type))

module.exports = ListModel